<?php
namespace App\Controllers\Diary\Page;
use App\Models\Diary\Diary;

/**
*	日记详情页
*/
class RijiZW extends  \App\Libs\Base\BaseTwigAction 
{
    protected function beforeRun() {
        parent::beforeRun();
	//	 $this->needLogin = TRUE;
    }
	
	public function execute() {
		$gid = (int)$this->request->get("gid");
		
		$diary = Diary::find( array(
			' id = :gid:',
			'bind'=>array( 'gid'=>$gid )
		) );
		if( empty($diary) ){
			$diary->read_num += 1;
			$diary->save();
		}
		
		$this->addParam('gid',$gid);
		
		return parent::execute();
	}
}
